package com.nsgf.library.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import com.nsgf.library.utils.Kits;

import java.util.List;

public class AddressBean implements Parcelable {
    /**
     * name : yunai
     * mobile : 15601691300
     * areaId : 140302
     * detailAddress : 芋道源码 233 号 666 室
     * defaultStatus : false
     * id : 21
     * areaName : 山西省 阳泉市 城区
     */

    private String name;
    private String mobile;
    private int areaId;
    private String detailAddress;
    private boolean defaultStatus;
    private int id;
    private String areaName;
    private String nickname;
    private String avatar;
    private long createTime;

    public AddressBean(){}

    protected AddressBean(Parcel in) {
        name = in.readString();
        mobile = in.readString();
        areaId = in.readInt();
        detailAddress = in.readString();
        defaultStatus = in.readByte() != 0;
        id = in.readInt();
        areaName = in.readString();
        nickname = in.readString();
        avatar = in.readString();
        createTime = in.readLong();
    }

    public static final Creator<AddressBean> CREATOR = new Creator<AddressBean>() {
        @Override
        public AddressBean createFromParcel(Parcel in) {
            return new AddressBean(in);
        }

        @Override
        public AddressBean[] newArray(int size) {
            return new AddressBean[size];
        }
    };

    public String getName() {
        return name;
    }

    public String getNameAndPhone() {
        return name + "  " + getMobile();
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public int getAreaId() {
        return areaId;
    }

    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    public boolean isDefaultStatus() {
        return defaultStatus;
    }

    public void setDefaultStatus(boolean defaultStatus) {
        this.defaultStatus = defaultStatus;
    }

    public int getId() {
        return id;
    }
    public String getIdSrc() {
        return "ID:"+id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public long getCreateTime() {
        return createTime;
    }

    public String getCreateTimeSrc() {
        return "注册时间："+ Kits.Date.getYmdhhms(getCreateTime());
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(mobile);
        dest.writeInt(areaId);
        dest.writeString(detailAddress);
        dest.writeByte((byte) (defaultStatus ? 1 : 0));
        dest.writeInt(id);
        dest.writeString(areaName);
        dest.writeString(nickname);
        dest.writeString(avatar);
        dest.writeLong(createTime);
    }
}
